<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="">
  <input type="text" name="id" :value="emp.id" readonly>
  <input type="text" name="name" :value="emp.name">
  <input type="text" name="sal" :value="emp.sal">
  <input type="text" name="job" :value="emp.job">
  <input type="button" value="修改" @click="update()">
</form>

<script src="js/vue.min.js"></script>
<script src="js/axios.min.js"></script>
<script>

  let v = new Vue({
    el:"form",
    data:{
      emp:"",
    },
      created:function (){
        let id = location.search.split("=")[1];
        axios.get("/selectById?id="+id).then(function (response){
            v.emp = response.data;
        })
      },
    methods:{
        update(){
            let data = new FormData(document.querySelector("form"))
            axios.post("/update",data).then(function (response){
                location.href="/list.html";
            })
        }
    }
  })
</script>
</body>
</html>